package com.app.freshmenapp.tools;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Auther: Administrator
 * @Date: 2019.07.21 08:50
 * @Description:
 */

@Component
public class FunctionExample {

    public Map<String,Object> findAll(List<?> list){
        Map<String,Object> map=new HashMap<>();
        map.put("success",true);
        map.put("msg","成功");
        map.put("list",list);
        return map;
    }

    public Map<String,Object> findOne(Object function){

        Map<String,Object> map=new HashMap<>();
        if (function==null){
            map.put("success",false);
            map.put("msg","失败");
        }else{
            map.put("success",true);
            map.put("msg","成功");
            map.put("data",function);
        }
        return map;
    }

    public Map<String,Object> otherOne(boolean judge){

        Map<String,Object> map=new HashMap<>();
        if(judge==false){
            map.put("success",false);
            map.put("msg","失败");
        }else{
            map.put("success",true);
            map.put("msg","成功");
        }
        return map;
    }

}
